<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>重庆轮廓（画线）</title>
    <link rel="stylesheet" href="../css/ol.css" type="text/css">
    <script src="js/jquery-1.12.3.min.js"></script>
    <script src="js/mapMain.js"></script>
    <script src="../build/ol.js"></script>
</head>
<body>
<div>
    <input type="button" onclick="showCq();" value="展示"/>
    <input type="button" onclick="hideCq();" value="隐藏"/>
</div>
<div id="map"></div>

</body>
<script type="text/javascript">

    var all_map;//定义地图全局变量

    $(function(){
        var options = {id:'map'};
        all_map = showMap(options);
    })

    function hideCq(){
        remove({
            map: all_map
        });
    }

    function showCq(){
        setCenter(all_map);
        $.getJSON('json/city/chongqing.json', function (data) {
            var cq = data.geometry.coordinates[0];//重庆坐标点
            if (cq && cq.length > 0) {
                drawPolygon(cq,'yellow',all_map);
            }
        });
    }


</script>
</html>